import {defineConfig} from 'vite';
import vue from '@vitejs/plugin-vue';
import proxyConfig from './proxy.config';
import styleImport from 'vite-plugin-style-import';
//@ts-ignore
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
    server: {
        cors: true,
        port: 7045,
        //强制预加载依赖
        force: true,
        //强制端口
        strictPort: false,
        proxy: proxyConfig
    },
    build: {},
    plugins: [
        vue(),
        styleImport({
            libs: [
                {
                    libraryName: 'element-plus',
                    esModule: true,
                    ensureStyleFile: true,
                    resolveStyle: (name) => {
                        name = name.slice(3);
                        return `element-plus/packages/theme-chalk/src/${name}.css`;
                    },
                    resolveComponent: (name) => {
                        return `element-plus/lib/${name}`;
                    }
                }
            ]
        })
    ],
    resolve: {
        alias: {
            //@ts-ignore  设置别名
            '@': path.resolve(__dirname, './src'),
            //@ts-ignore
            '@static': path.resolve(__dirname, './src/static')
        }
    }
});
